package org.pettyfox.test.utils.dbpress;

import org.mybatis.spring.annotation.MapperScan;
import org.pettyfox.test.utils.dbpress.service.BatchSaveService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@SpringBootApplication
@MapperScan("org.pettyfox.test.utils.dbpress.modules.mapper")
@EnableScheduling
@RestController
public class DbPressApplication {
    @Resource
    private BatchSaveService batchSaveService;

    void contextLoads() {

    }
    @GetMapping("")
    public String test(@RequestParam(value = "batchSize",defaultValue = "1")Integer batchSize
    ,@RequestParam(value = "rowSize",defaultValue = "10")Integer rowSize){
        batchSaveService.startDbPress(20,rowSize,batchSize);
        return "ok";
    }
    public static void main(String[] args) {
        SpringApplication.run(DbPressApplication.class, args);
    }

}
